package com.xvxingan.mvc.mq.service;

import java.util.Map;

import javax.annotation.PostConstruct;

import org.apache.camel.CamelContext;
import org.apache.camel.Consume;
import org.apache.camel.Headers;
import org.apache.camel.Produce;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("mqService3")
public class MqService3 {
	//这种情况下不会创建队列和主题
	@Produce(uri="jms:a1")
	public ProducerTemplate dufaultTemplate;
/*	@Produce(uri="jms:queue:a1")
		private ProducerTemplate template1;*/
/*	@Produce(uri="jms:topic:b1")
	public ProducerTemplate template2;*/
	@Produce(uri="jms:topic:VirtualTopicConsumers.b2")
	public ProducerTemplate template3;
	@Produce(uri="jms:topic:VirtualTopicConsumers.b2.c1")
	public ProducerTemplate template4;
	
	@Produce(uri="jms:topic:demo")
	public ProducerTemplate demo;
	@Autowired
	public CamelContext camelContext;
	
 
/*	@Consume(uri="jms:topic:demo")//产生一个主题队列jms:topic:b1
	public void demo1(@Headers() Map<String,String> map){
		System.out.println("jms:topic:demo收到消息");
	}*/
	@Consume(uri="jms:queue:VirtualTopicConsumers.a.demo")//产生一个主题队列jms:topic:b1
	public void demo2(@Headers() Map<String,String> map){
		System.out.println("jms:queue:VirtualTopicConsumers.a.demo收到消息");
	}
	@Consume(uri="jms:queue:VirtualTopicConsumers.b.demo")//产生一个主题队列jms:topic:b1
	public void demo3(@Headers() Map<String,String> map){
		System.out.println("jms:queue:VirtualTopicConsumers.b.demo收到消息");
	}
 
	
/*	@Consume(uri="jms:a1")//产生一个队列 等价于jms:queue:a1
	public void test1(@Headers() Map<String,String> map){
		System.out.println("jms:a1 收到消息");
	}
	@Consume(uri="jms:queue:a1")//产生一个队列jms:queue:a1
	public void test2(@Headers() Map<String,String> map){
		System.out.println("jms:queue:a1收到消息");
	}
	*/
	@Consume(uri="jms:topic:b1")//产生一个主题队列jms:topic:b1
	public void test3(@Headers() Map<String,String> map){
		System.out.println("jms:topic:b1收到消息");
	}
	@Consume(uri="jms:topic:Vt.b2")//产生一个主题队列jms:topic:b1
	public void test4(@Headers() Map<String,String> map){
		System.out.println("jms:topic:Vt.b2收到消息");
	}
	@Consume(uri="jms:queue:Vt.b2")//产生一个主题队列jms:topic:b1
	public void test5(@Headers() Map<String,String> map){
		System.out.println("jms:queue:Vt.b2收到消息");
	}
	@Consume(uri="jms:queue:abc.Vt.b2")//产生一个主题队列jms:topic:b1
	public void test6(@Headers() Map<String,String> map){
		System.out.println("jms:queue:abc.Vt.b2收到消息");
	}
	@Consume(uri="jms:queue:Vt.b2.b21")//产生一个主题队列jms:topic:b1
	public void test7(@Headers() Map<String,String> map){
		System.out.println("jms:queue:Vt.b2.b21收到消息");
	}
	@Consume(uri="jms:queue:Vt.b2.b22")//产生一个主题队列jms:topic:b1
	public void test8(@Headers() Map<String,String> map){
		System.out.println("jms:queue:Vt.b2.b22收到消息");
	}
}
